﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_ThemKiHieu : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CboLoaiIn")]
        private ComboBox _CboLoaiIn;
        [AccessedThroughProperty("CmdChon")]
        private Button _CmdChon;
        [AccessedThroughProperty("CmdThoat")]
        private Button _CmdThoat;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("Label3")]
        private Label _Label3;
        [AccessedThroughProperty("txtDienGiai")]
        private TextBox _txtDienGiai;
        [AccessedThroughProperty("txtSoKiHieu")]
        private TextBox _txtSoKiHieu;
        private IContainer components;
        public object objFrmCall;

        [DebuggerNonUserCode]
        public Frm_ThemKiHieu()
        {
            base.Load += new EventHandler(this.Frm_ThemKiHieu_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdChon_Click(object sender, EventArgs e)
        {
            if (this.txtSoKiHieu.Text.Trim() == "")
            {
                LVYModule.ShowWarning("Vui l\x00f2ng nhập số k\x00ed hiệu");
                this.txtSoKiHieu.Focus();
            }
            else if (!this.KtraTrung(this.txtSoKiHieu.Text.Trim()))
            {
                LVYModule.ShowWarning("Số k\x00ed hiệu n\x00e0y đ\x00e3 tồn tại!");
                this.txtSoKiHieu.Focus();
            }
            else
            {
                try
                {
                    string str = "";
                    str = Conversions.ToString(LVYModule.ReturnIfNull(this.txtDienGiai.Text, "", modGeneral.TypeOfValue.Nothing));
                    string commandText = "";
                    commandText = Conversions.ToString(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(Microsoft.VisualBasic.CompilerServices.Operators.ConcatenateObject(("INSERT INTO HT_SoKiHieu values ('" + this.txtSoKiHieu.Text.Trim() + "',0,'") + str + "',", this.CboLoaiIn.SelectedValue), ")"));
                    DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]);
                    NewLateBinding.LateCall(this.objFrmCall, null, "LoadDSKiHieu", new object[0], null, null, null, true);
                    this.Dispose();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                    return;
                    ProjectData.ClearProjectError();
                }
            }
        }

        private void CmdThoat_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_ThemKiHieu_Load(object sender, EventArgs e)
        {
            BuildComboModule.BuildCombo(this.CboLoaiIn, modGeneral.ListDanhMuc.LoaiIn, false, "", "");
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_ThemKiHieu));
            this.Label1 = new Label();
            this.Label2 = new Label();
            this.txtSoKiHieu = new TextBox();
            this.txtDienGiai = new TextBox();
            this.CmdChon = new Button();
            this.CmdThoat = new Button();
            this.CboLoaiIn = new ComboBox();
            this.Label3 = new Label();
            this.SuspendLayout();
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            Point point = new Point(0x1d, 0x1d);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            Size size = new Size(0x38, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0;
            this.Label1.Text = "Số k\x00ed hiệu";
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new Point(0x1d, 0x37);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x30, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 2;
            this.Label2.Text = "Diễn giải";
            point = new Point(0x5b, 0x1a);
            this.txtSoKiHieu.Location = point;
            this.txtSoKiHieu.Name = "txtSoKiHieu";
            size = new Size(0x5e, 20);
            this.txtSoKiHieu.Size = size;
            this.txtSoKiHieu.TabIndex = 1;
            point = new Point(0x5b, 0x34);
            this.txtDienGiai.Location = point;
            this.txtDienGiai.Name = "txtDienGiai";
            size = new Size(0x144, 20);
            this.txtDienGiai.Size = size;
            this.txtDienGiai.TabIndex = 3;
            this.CmdChon.Image = (Image) manager.GetObject("CmdChon.Image");
            this.CmdChon.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(260, 120);
            this.CmdChon.Location = point;
            this.CmdChon.Name = "CmdChon";
            size = new Size(0x4f, 0x1b);
            this.CmdChon.Size = size;
            this.CmdChon.TabIndex = 4;
            this.CmdChon.Text = "&Chọn";
            this.CmdChon.UseVisualStyleBackColor = true;
            this.CmdThoat.Image = ACCOUNTING.My.Resources.Resources.Closed;
            this.CmdThoat.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0x159, 120);
            this.CmdThoat.Location = point;
            this.CmdThoat.Name = "CmdThoat";
            size = new Size(0x4f, 0x1b);
            this.CmdThoat.Size = size;
            this.CmdThoat.TabIndex = 5;
            this.CmdThoat.Text = "&Tho\x00e1t";
            this.CmdThoat.UseVisualStyleBackColor = true;
            this.CboLoaiIn.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CboLoaiIn.FormattingEnabled = true;
            point = new Point(0x5b, 0x4e);
            this.CboLoaiIn.Location = point;
            this.CboLoaiIn.Name = "CboLoaiIn";
            size = new Size(0x79, 0x15);
            this.CboLoaiIn.Size = size;
            this.CboLoaiIn.TabIndex = 6;
            this.Label3.AutoSize = true;
            this.Label3.BackColor = Color.Transparent;
            point = new Point(0x1d, 0x51);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x27, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 7;
            this.Label3.Text = "Loại In";
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x1ab, 0x9f);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.Label3);
            this.Controls.Add(this.CboLoaiIn);
            this.Controls.Add(this.CmdThoat);
            this.Controls.Add(this.CmdChon);
            this.Controls.Add(this.txtDienGiai);
            this.Controls.Add(this.txtSoKiHieu);
            this.Controls.Add(this.Label2);
            this.Controls.Add(this.Label1);
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.Name = "Frm_ThemKiHieu";
            this.Text = "THEM KI HIEU HOA DON";
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        public bool KtraTrung(string strSoKyHieu)
        {
            DataTable table = new DefaultValue().LoadKiHieuList("");
            if (table != null)
            {
                int num2 = table.Rows.Count - 1;
                for (int i = 0; i <= num2; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(strSoKyHieu, table.Rows[i]["SoKiHieu"], false))
                    {
                        return false;
                    }
                }
            }
            return true;
        }

        internal virtual ComboBox CboLoaiIn
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CboLoaiIn;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CboLoaiIn = value;
            }
        }

        internal virtual Button CmdChon
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdChon;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdChon_Click);
                if (this._CmdChon != null)
                {
                    this._CmdChon.Click -= handler;
                }
                this._CmdChon = value;
                if (this._CmdChon != null)
                {
                    this._CmdChon.Click += handler;
                }
            }
        }

        internal virtual Button CmdThoat
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdThoat;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdThoat_Click);
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click -= handler;
                }
                this._CmdThoat = value;
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual TextBox txtDienGiai
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtDienGiai;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtDienGiai = value;
            }
        }

        internal virtual TextBox txtSoKiHieu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtSoKiHieu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtSoKiHieu = value;
            }
        }
    }
}

